package javaRew;


/**
 * Created by xjweng on 2017/2/1.
 */

public abstract class Employee {
    private String name;
    private int number;
    private MyDate birthday;

    abstract int earnings();

    @Override
    public String toString() {
        return "name: " + name + " number: " + number + " birthday: " + birthday.toDayString();
    }
}
class MyDate {
    private int month;
    private int day;
    private int year;

    public MyDate(int month, int day, int year){
        this.month = month;
        this.day = day;
        this.year = year;
    }
    public String toDayString(){
        return year + "年" + month + "月" + day + "日";
    }
}

class SalariedEmployee extends Employee {
    private int weeklySalary;

    @Override
    int earnings() {
        return weeklySalary;
    }

    @Override
    public String toString() {
        return "EmployeeType: SalariedEmployee " + super.toString();
    }
}
class HourlyEmployee extends Employee {
    private int wage;
    private int hour;

    @Override
    int earnings() {
        return wage*hour;
    }

    @Override
    public String toString() {
        return "EmployeeType: HourlyEmployee " + super.toString();
    }
}
